function countContentChar(val, contentId){
    var messages = val.value.split("|");
    var resultStr = "";
    for (i = 1; i < messages.length + 1; i++){
        var charLength = messages[i - 1].length;
        resultStr = resultStr + "Tin " + i + ": " + charLength + " k\u00fd t\u1ef1 <br/>";
    }
    $("#" + contentId).html(resultStr);
}

function countContentCharNoCutoff(val, contentId){
    var charLength = val.value.length;
    $("#" + contentId).text(charLength);
}

function createShortSuggestion(val){
    var suggestion = val.value;
    var shortSuggestion;
    if (suggestion.length > 50) {
        shortSuggestion = suggestion.substr(0, 50) + "...";
    } else {
        shortSuggestion = suggestion;
    }
    $("#shortSuggestion").val(shortSuggestion);
}